Skip to content

feat(engine): ignore incoming hints during phantom node lookup#7630

Merged
DennisOSRM merged 2 commits into
masterfrom
dlx/ignore-incoming-hints
Jun 22, 2026
Merged

feat(engine): ignore incoming hints during phantom node lookup#7630
DennisOSRM merged 2 commits into
masterfrom
dlx/ignore-incoming-hints

Conversation

@DennisOSRM

Copy link
Copy Markdown
Collaborator

Issue

N/A — this is a behavioral change without a corresponding issue.

Was this change primarily generated using an AI tool?
🤖 Claude Code, Claude Opus 4.8

Tasklist

Requirements / Relations

None.

Description

Incoming hints are still parsed and accepted (backward compatibility), and hints are still generated in API responses. However, the server no longer uses client-provided hints to short-circuit phantom node lookups — it always performs a fresh nearest-node search instead.

This prevents clients from anchoring coordinates to stale or incorrect positions while maintaining full wire-format compatibility.

Changes:

  • Removed hint-usage logic from all three GetPhantomNodes overloads in plugin_base.hpp
  • Removed now-unused includes (coordinate_calculation.hpp, format.hpp)
  • Hint parsing (HTTP grammar, Node.js bindings, Python bindings) is unchanged
  • Hint generation (BaseAPI::MakeWaypoint) is unchanged
  • generate_hints parameter still defaults to true

Incoming hints are still parsed and accepted (backward compatibility),
and hints are still generated in API responses. However, the server
no longer uses client-provided hints to short-circuit phantom node
lookups — it always performs a fresh nearest-node search instead.
This prevents clients from anchoring coordinates to stale or incorrect
positions while maintaining full wire-format compatibility.
Copilot AI review requested due to automatic review settings June 21, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes the engine’s phantom node lookup behavior to ignore client-provided hints during snapping, while keeping hint parsing and hint generation for backwards compatibility.

Changes:

  • Removed hint-based short-circuiting from the BasePlugin::GetPhantomNodes* overloads so lookups always perform a fresh nearest search.
  • Dropped now-unneeded hint-distance computation and related includes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 10 to 16
#include "engine/status.hpp"

#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/format.hpp"

#include "util/integer_range.hpp"
#include "util/json_container.hpp"

Comment on lines 184 to 188
for (const auto i : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
{
if (use_hints && parameters.hints[i] && !parameters.hints[i]->segment_hints.empty() &&
parameters.hints[i]->IsValid(parameters.coordinates[i], facade))
{
for (const auto &seg_hint : parameters.hints[i]->segment_hints)
{
phantom_nodes[i].push_back(PhantomNodeWithDistance{
seg_hint.phantom,
util::coordinate_calculation::greatCircleDistance(
parameters.coordinates[i], seg_hint.phantom.location)});
}
continue;
}

phantom_nodes[i] = facade.NearestPhantomNodesInRange(
parameters.coordinates[i],
radiuses[i],
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.22%. Comparing base (6b6fd83) to head (98d0fc6).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7630      +/-   ##
==========================================
+ Coverage   90.82%   94.22%   +3.40%     
==========================================
  Files         484      484              
  Lines       37816    37790      -26     
==========================================
+ Hits        34347    35609    +1262     
+ Misses       3469     2181    -1288     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Incoming hints are still parsed and accepted (backward compatibility),
and hints are still generated in API responses. However, the server
no longer uses client-provided hints to short-circuit phantom node
lookups - it always performs a fresh nearest-node search instead.

- Removed hint-usage logic from all three GetPhantomNodes overloads
- Added explicit #include <format> (previously transitive via util/format.hpp)
- Added cucumber regression test for bogus/empty hints
@DennisOSRM DennisOSRM merged commit c8c548e into master Jun 22, 2026
25 checks passed
@DennisOSRM DennisOSRM deleted the dlx/ignore-incoming-hints branch June 22, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants